﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SmartSpace.Core;
using SmartSapce.ServiceLocation;
using SmartSpace.Web;

namespace SmartSpace.WebApp
{
    public partial class _entry : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect(string.Format("~/_launcher.aspx?id={0}", SsSite.Current.Id));


            //if (string.IsNullOrEmpty(Request.QueryString["id"]))
            //{
            //    ICoreService service = ServiceLocator.Get<ICoreService>();
            //    Application application = service.GetApplications()[0];//.GetPersonalDefaultApplication(User.Identity.Name);
            //    if (application.Type == "_webpart")
            //    {
            //        Response.Redirect(string.Format("~/_launcher.aspx?id={0}", application.Id));
            //    }
            //    else
            //    {
            //        Response.Redirect(string.Format("~/_app/{0}/_launcher.aspx?id={1}", application.Type, application.Id));
            //    }
            //}
            //else
            //{
            //    Guid id = new Guid(Request.QueryString["id"]);

            //    ICoreService service = ServiceLocator.Get<ICoreService>();

            //    Application application = service.GetApplication(id);
            //    Response.Redirect(string.Format("~/_app/{0}/_launcher.aspx?id={1}", application.Type, application.Id));
            //}
        }
    }
}